﻿<Window x:Class="MVVMCommand.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:b="clr-namespace:MVVMCommand.Behavior"
        Title="FormatText" Height="350" Width="525">
    <Canvas HorizontalAlignment="Left" Height="320" VerticalAlignment="Top" Width="517">
        <TextBox Height="23" Canvas.Left="10" TextWrapping="Wrap" 
                 Text="{Binding OriginalText, UpdateSourceTrigger=PropertyChanged}" 
                 Canvas.Top="10" Width="120">
            <i:Interaction.Behaviors>
                <b:TextBoxBehavior RegularExpression="[0-9]+"/>
            </i:Interaction.Behaviors>
        </TextBox>
        <TextBox Height="23" Canvas.Left="140" TextWrapping="Wrap" 
                 Text="{Binding FormattedText, UpdateSourceTrigger=PropertyChanged}" 
                 Canvas.Top="10" Width="120"/>
        <Button Content="Format Text" Command="{Binding FormatCommand}" Canvas.Left="10" Canvas.Top="38" Width="75"/>
    </Canvas>
</Window>
